package pt.isel.lercm.projectmanager.managedController.generic;

import pt.isel.lercm.projectmanager.auxobjects.Mode;

public abstract class GenericManagedBeanEntity <T> extends GenericManagedBean{
	
	private String mode;

	public String getMode() {
		return mode;
	}

	public void setMode(String mode) {
		this.mode = mode;
	}
	
	public void gravar(){
		if (getMode().equals(Mode.NOVO.mode)){
			gravarNovo();
		}
		else{
			gravarEditar();
		}
	}
	
	public boolean isDisableComponent(){
		if (getMode().equals(Mode.LEITURA.mode) || getMode().equals(Mode.DISABLED.mode)){
			return true;
		}
		
		return false;
	}
	
	public void editar() {
		setMode(Mode.EDICAO.mode);
	}
	
	public abstract void novo();
	
	public abstract void apagar(T object);
	
	public abstract void gravarNovo();
	
	public abstract void gravarEditar();
	
	
	
}
